<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>忘记密码-分销系统后台</title>
		<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
		<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	</head>
	<body class="layui-bg-gray">
		<div class="layui-bg-black" style="height: 50px;">
			<div style="float: left;color: #fff;font-size: 15pt;margin: 10px 20px;">
				分销商城后台
			</div>
		</div>
		<div class="layui-container">
			<div style="text-align: center;font-size: 30pt;
				margin: 70px 0px 50px 0px;font-weight: 30px;color: #000;">忘记密码
			</div>
			<div class="layui-panel" style="border-radius: 5px;">
				<div style="height: 350px;text-align: center;">
					<div style="margin-top: 100px;font-size: 15px;color: #000;">
						如果您的账号可以通过邮箱获取，请输入邮箱重设登录密码。
					</div>
					<form class="layui-form">
					<div style="margin: 50px auto;width: 600px;">
						<input type="text" id="email" name="email" lay-verify="required|email" class="layui-input layui-border-blue" style="width: 600px;height: 50px;" placeholder="邮箱地址" autocomplete="off" />
					</div>
					<div class="layui-form-item" >
						<div style="margin: 50px auto;width: 600px;">
							<a id="next" class="layui-btn layui-btn-normal layui-btn-fluid" style="height: 45px;" lay-submit="" lay-filter="next">下一步</a>
						</div>
					</div>
					</form>
				</div>
			</div>
		</div>	
		<script>
			var $;
			layui.use(['form','layer','jquery'],function(){
				var form = layui.form,
					layer = layui.layer;
					$ = layui.jquery;

				$('body').keydown(function () {
					if (event.keyCode == 13){
						$('#next').click();
					}
				})
				
				
				form.on('submit(next)',function(data){
					var formData = data.field;
					var email = formData.email;
					var emails = [];
					emails.push(email);
					$.ajax({
						type:'post',
						url:'/send/sc/email',
						data:{
							emails:emails,
							type: "forgetPwd"
						},
						dataType:'json',
						success:function (result) {
							if (result.is){
								window.location.href = '/page/forgetNext?email='+email;
							}else {
								layer.msg("邮件发送失败，请稍后重试",{icon:1})
							}
						}
					});

				})
			});
		</script>
	</body>
</html>
